<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
  <title>读者列表</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <!-- 引入 Bootstrap -->
  <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>

<div class="container">
  <div class="row clearfix">
    <div class="col-md-12 column">
      <div class="page-header">
        <h1>
          <small>读者列表 —— 显示所有读者</small>
        </h1>
        <a style="float: right" href="${pageContext.request.contextPath}/login/exportUser">导出excel表</a>
      </div>
    </div>
  </div>

  <div class="row">
    <div style="display: inline">
      <div style="display: inline-block">
        <form action="${pageContext.request.contextPath}/login/searchUser" method="GET" >
          <input type="text" name="keyUserName">
          <input type="submit" value="用户名搜索">
        </form>
      </div>
    </div>
  </div>

  <div class="row clearfix">
    <div class="col-md-12 column">
      <table class="table table-hover table-striped">
        <thead>
        <tr>
          <th>读者姓名</th>
          <th>密码</th>
          <th>身份</th>
        </tr>
        </thead>

        <tbody>
        <c:forEach var="user" items="${pageInfo.list}">
          <tr>
            <td>${user.username}</td>
            <td>****</td>
            <td>${user.userType}</td>
          </tr>
        </c:forEach>
        </tbody>
      </table>
    </div>
    <div class="box-tools pull-right">
      <ul class="pagination">
        <li><a href="${pageContext.request.contextPath}/readerIndex?page=1&size=5"
               aria-label="Previous">首页</a></li>
        <li>
          <a href="${pageContext.request.contextPath}/readerIndex?page=${pageInfo.pageNum-1}&size=5">上一页</a>
        </li>
        <c:forEach begin="1" end="${pageInfo.pages}" var="pageNum">
          <li>
            <a href="${pageContext.request.contextPath}/readerIndex?page=${pageNum}&size=5">${pageNum}</a>
          </li>
        </c:forEach>
        <li>
          <a href="${pageContext.request.contextPath}/readerIndex?page=${pageInfo.pageNum+1}&size=5">下一页</a>
        </li>
        <li><a href="${pageContext.request.contextPath}/readerIndex?page=${pageInfo.pages}&size=5"
               aria-label="Next">尾页</a></li>
      </ul>
    </div>
  </div>
</div>